<!DOCTYPE html>
<body>
<script src="../../../resources/js-test.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
<input type="date" id="date1" onchange="changeType(this)" value="2000-01-01">
<script>
description('Check if we have no crash in a case that the input type is changed by selecting a day in the calendar picker.');

openPicker(document.getElementById('date1'), selectDay);

function selectDay() {
    eventSender.keyDown('ArrowRight');
    eventSender.keyDown('Enter');
}

function changeType(input) {
    input.type = 'text';
    testPassed('unless crash');
    waitUntilClosing(finishJSTest);
}
</script>
</body>
